﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace coleções
{
    class ExemploHashTable
    {

        public static void Go()   {

            Hashtable hashTable = new Hashtable();
            hashTable.Add(1, "Teste");
            hashTable.Add(2, "Aula");
            hashTable.Add(3, "C#");
            hashTable.Add(4, "ASP .NET");

            Console.WriteLine("As chaves do hashtable :--");

            foreach (var item in hashTable.Keys)
            {
                Console.WriteLine("Chave {0} {1}", item, hashTable[item]);
            }

            Console.WriteLine("Informe a chave para procurar : ");
            int p = int.Parse(Console.ReadLine());

            if (hashTable.ContainsKey(p))
            {
                Console.WriteLine(hashTable[p].ToString());
            }
            else
            {
                Console.WriteLine("Chave não localizada");
            }
        }

    }
}
